@echo off
set name=todo-list.jar
for /f "usebackq tokens=1,2" %%a in (`jps -l ^|findstr %name%`) do (
set pid=%%a
set pname=%%b
)
if not defined pid (echo process %name% does not exists) else (
rem 根据进程ID，kill进程
taskkill /f /pid %pid%
)
rem 暂停2秒
ping /n 2 127.1>nul
set dt=%date:~0,4%%date:~5,2%%date:~8,2%
java -jar D:\App\todo-list\todo-list.jar >> D:\App\todo-list\log\log%dt%.txt
exit